Skip to main content

FF-API-External Quick Start Guide

This quick start guide will help you set up and start using FF-API-External quickly. We'll cover basic installation, configuration, and running your first requests.

Prerequisites

Before starting, make sure you have:

  • Python 3.11.9 installed
  • Git installed
  • MySQL and MongoDB installed and running
  • API keys for the third-party services you want to use

Installation in 5 Minutes

Follow these steps to get FF-API-External up and running:

1. Clone the Repository

git clone https://github.com/yourusername/ff-api-external.git
cd ff-api-external

2. Create and Activate a Virtual Environment

python3.11 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Create a Configuration File

Copy the example .env file and update it with your credentials:

cp .env.example .env  # If .env.example exists, otherwise create new .env file

At minimum, configure the following variables in your .env file:

# Database configurations
MYSQL_HOST=localhost
MYSQL_USER=your_mysql_user
MYSQL_PASSWORD=your_mysql_password
MYSQL_DB=main
MYSQL_CURSORCLASS=DictCursor
MYSQL_PORT=3306

# MongoDB configurations
MONGODB_MAIN_PROD=mongodb://localhost:27017/gateway

# API keys for services you plan to use
CHAT_GPT_API_KEY=your-openai-api-key
CLAUDE_API_KEY=your-claude-api-key
# Other API keys as needed...

5. Run the Service

Start the development server:

python server.py

This will start the service on port 5060 with debug mode enabled.

Testing the API

Once your service is running, you can test it with the following simple requests:

1. Test a Simple Endpoint

Using curl:

curl -X GET "http://localhost:5060/api/v1/gsmarena/brands"

Using Python requests:

import requests

response = requests.get("http://localhost:5060/api/v1/gsmarena/brands")
print(response.json())

2. Test an AI Endpoint

Using curl:

curl -X POST "http://localhost:5060/api/v1/claude/prompt" \
-d "prompt=Tell me about AI" \
-d "max_tokens=1000" \
-d "temperature=0.7"

Using Python requests:

import requests

data = {
"prompt": "Tell me about AI",
"max_tokens": 1000,
"temperature": 0.7
}
response = requests.post("http://localhost:5060/api/v1/claude/prompt", data=data)
print(response.json())

Common Endpoints

Here are some of the most commonly used endpoints in FF-API-External:

AI Endpoints

  • Claude AI: POST /api/v1/claude/prompt
  • ChatGPT: POST /api/v1/openai/chatgpt/prompt
  • Product Matching (Claude): POST /api/v1/claude/product/match
  • Product Specifications (ChatGPT): GET /api/v1/openai/chatgpt/prompt/product/spec

Device Information

  • GSM Arena Brands: GET /api/v1/gsmarena/brands
  • GSM Arena Device List: GET /api/v1/gsmarena/device-list
  • IMEI Validation: GET /api/imeitomodel/checkvalid/{imei}
  • IMEI to Model: GET /api/imeitomodel/getmodel/{imei}

Vehicle Information

  • Vehicle Years: GET /vapi/years
  • Vehicle Makes: GET /vapi/makes
  • Vehicle Models: GET /vapi/models/{make}
  • Vehicle VIN Decode: GET /api/vindecoder/decode/{vin}
  • Place Search: GET /api/v1/place/serp/search?q={query}&ll={lat,lon}
  • Image Search: GET /serp/image/search/generic/{prompt}

Communications

  • Send Email (Brevo): POST /api/brevo/send-email
  • Send SMS (Hubtel): GET /api/hubtel/send-quick-sms

Next Steps

Now that you have the basic service running, you can:

  1. Explore the Documentation: Review the full documentation to understand the various endpoints and configurations.

  2. Configure More Services: Add API keys for additional third-party services you want to use.

  3. Integrate with Your Application: Start integrating FF-API-External into your main application.

  4. Deploy to Production: When you're ready, follow the deployment guide to set up the service in a production environment.

Troubleshooting

If you encounter issues, check the following:

  • Ensure all dependencies are correctly installed
  • Verify your database connections are working
  • Check that your API keys are valid and correctly configured in the .env file
  • Look at the server logs for specific error messages

For more detailed help, refer to the Troubleshooting document.